package com.ildepinc.persistence.concretes;

import java.io.File;
import java.util.Properties;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.ildepinc.persistence.abstracts.PersistenceLayer;

public class Persistence extends PersistenceLayer {

  static {
    try {
      Properties persistenceProperty = PropertiesReader.getPersistenceProperties();
      String fullPathName = persistenceProperty.getProperty("conf.path") + File.separator
          + persistenceProperty.getProperty("environment") + File.separator + "log4j2.xml";
      System.setProperty("log4j.configurationFile", fullPathName);
    } catch (Exception e) {
      e.printStackTrace();
      throw new RuntimeException();
    }
  }

  private static Logger logger = LogManager.getLogger(Persistence.class);

  public Persistence() {
    this.clear();
    this.setLogger(logger);
  }

}
